import Vue from 'vue'
import Router from 'uni-simple-router';
Vue.use(Router)

const router = new Router({
	encodeURI:false,
	h5:{
			loading: false,
	},
  routes:[
    {
        //注意：path必须跟pages.json中的地址对应，最前面别忘了加'/'哦
			path: '/pages/index/index',
			name: 'index',//在路由跳转时可直接使用name来跳转，后面会讲到
		aliasPath:'/',  //对于h5端你必须在首页加上aliasPath并设置为/
        //可以自定义路由元信息
        myDiy:{
            isTab:true
        },
        meta: {
	        title: '首页',
	    },
    },
    {
	    path: '/pages/audio/audio',
        name: 'audio',
        meta: {
	        title: '媒体',
			 }
	  },
    {
	    path: '/pages/login/login',
        name: 'login',
        meta: {
	        title: '登录',
			 }
	  },
    {
	    path: '/pages/map/map',
        name: 'map',
        meta: {
	        title: '地图',
			 }
	  },
    {
	    path: '/pages/upload/upload',
        name: 'upload',
        meta: {
	        title: '上传',
			 }
	  },
		{
			path: '/pages/drag/drag',
			name: 'drag',
			meta: {
				title: '拖拽',
		 }
		},
	//分包1
    {
	    path: '/pageschar/pages/index/index',
        name: 'indexChild1',
        meta: {
	        title: '分包首页1',
				}
	  },
		

  ]
});


router.beforeEach((to, from, next) => {
	if(to.path != from.path){
		if(to.path == '/pages2/index/index'){
			// next('/pages/audio/audio')
			next()
		}else{
			console.log('跳转到router 跳转');
			next()
		}
		console.log(to.path,'111111111')
	}
})